<template>
	<Layout class="p-5 bg-white">
		<Form :label-width="80">
			<FormItem class="w-50" label="标题">
				<Input v-model="house.title" placeholder="请输入标题"></Input>
			</FormItem>
			<FormItem class="w-50" label="联系人">
				<Input v-model="house.persoName" placeholder="请输入联系人"></Input>
			</FormItem>
			<FormItem class="w-50" label="联系电话">
				<Input v-model="house.tel" placeholder="请输入联系电话"></Input>
			</FormItem>
			<FormItem class="w-50" label="联系微信">
				<Input v-model="house.wxNumber" placeholder="请输入联系微信"></Input>
			</FormItem>
			<FormItem class="w-50" label="目标描述">
				<Input v-model="house.detail" placeholder="请输入目标描述"></Input>
			</FormItem>
			<FormItem class="text-right">
				<Button @click="submit" type="primary">提交</Button>
				<Button @click="cancel" class="ml-2">取消</Button>
			</FormItem>
		</Form>
	</Layout>
</template>

<script>
	export default {
		data() {
			return {
				house: {
					title: "",
					detail: "",
					persoName:'',
					tel:'',
					wxNumber:'',
					clientId: 0,
				},
			}
		},
		created: function() {
			var cli = this.local.session.getItem("CURRENT");
			this.house.clientId = cli.client.clientId;
		},
		methods: {
			submit: function() {
				if (this.$data.title === null) {
					this.message.error("标题必须输入");
					return;
				}
				let self = this;
				this.http.post({
					url: "/house-buy-info/info",
					param: {
						title : this.$data.house.title,
						detail : this.$data.house.detail,
						personName: this.$data.house.personName,
						tel:this.$data.house.tel,
						wxNumber:this.$data.house.wxNumber,
						clientId : this.$data.house.clientId
					}
				}).then(data => {
					self.message.info("新增成功");
					this.$tabs.close();
					this.$router.push({
						name: "houseBuy"
					})
				})
			},
			cancel: function() {
				this.$tabs.close();
			}

		}
	}
</script>

<style>
</style>
